<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../css/swiper-4.3.5.min.css">
    <link rel="stylesheet" href="../css/element.css">
    <link rel="stylesheet" href="../css/main.css">
    <link rel="stylesheet" href="../css/person_center/person_center.css">
    <title>会员中心-退换货</title>
</head>

<body>
    <div id="app" v-cloak>
        <headers></headers>
        <!-- search -->
        <div class="search wrap">
            <logo></logo>
            <div class="header_tit fl"></div>
            <searchs></searchs>

            <car_box></car_box>

        </div>
        <div class="wrap person_center">
            <!-- nav -->
            <div class="nav_box fl">
                <div id="subapp" v-cloak>
                    <div class="person_nav fl">
                        <ul>
                            <li @click='person_order'>首页</li>
                            <li @click='person_center'>我的订单</li>
                            <li @click='person_address'>收货地址</li>
                            <li class="active">积分换货</li>
                            <li @click='person_integral'>积分订单</li>
                            <li @click='person_collection'>我的收藏</li>
                            <li @click='person_foot'>浏览足迹</li>
                            <li @click='person_ticket'>优惠券</li>
                            <li @click='person_info'>个人设置</li>
                            <li @click='person_message'>消息中心</li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="right_box fl">
                <div class='person_exchange_page'>
                    <div class="my_order_tit">
                        <div class="exchange_product">
                            商品
                        </div>
                        <div class="exchange_sub_tit">
                            积分
                        </div>
                        <div class="exchange_sub_tit">
                            服务类型
                        </div>
                        <div class="exchange_sub_tit">
                            退款状态
                        </div>
                        <div class="exchange_sub_tit">
                            交易操作
                        </div>
                    </div>

                    <div class="all_list">
                        <div class="all_item" v-for='(item,index) in exchange_list'>
                            <div class="all_item_tit">
                                <div class="fl item_data">
                                    {{item.createTime}}
                                </div>
                                <div class="fl item_num">
                                    <span>订单号：</span><span class="num_detail">{{item.spOrder.orderCode}}</span>
                                </div>
                                <div class="fl item_num">
                                    <span>退款编号：</span><span class="num_detail">{{item.returnCode}}</span>
                                </div>
                                <div class="fl item_name">
                                    <!-- <span class="fl">天马衡基仪器</span> <img src="../images/icon_kefu_0.png" alt="" class="kefu"> -->
                                </div>
                            </div>

                            <div class="item_detail">
                                <div class="mtop">
                                    <div class="exchange_product fl">
                                        <div class="detail_img fl">
                                            <img :src="item.goodsImage" alt="">
                                        </div>
                                        <div class="detail_tit fl">{{item.goodsName}}</div>
                                    </div>
                                    <div class="exchange_sub_tit fl">
                                        {{item.goodsPrice}}
                                    </div>
                                    <div class="exchange_sub_tit fl" v-if='item.type == 0'>退货</div>
                                    <div class="exchange_sub_tit fl" v-if='item.type == 1'>换货</div>
                                    <div class="exchange_sub_tit fl">
                                        <!-- <p class="red_color cursor" @click='person_exchange'>申请退款</p> -->
                                        <p class="red_color cursor" v-if='item.status == 0' @click='person_exchange'>申请中</p>
                                        <p class="red_color cursor"  v-else-if='item.status == 1'>同意换货</p>
                                        <p class="red_color cursor"  v-else-if='item.status == 2' >拒绝换货</p>
                                        <p class="red_color cursor"  v-else='item.status == 3' >已取消</p>

                                        <!-- <p v-if='item.status == 3'>已取消</p> -->
                                        <!-- <p v-else>取消</p> -->
                                    </div>
                                    <div class="exchange_sub_tit fl">
                                        <p class="cursor" v-if='item.status == 0' @click='concel_exchange(item.id,3)'>取消</p>
                                        <p v-if='item.status == 2' class="cursor" @click='concel_exchange(item.id,0)'>重新申请</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>




        <div class="wrap">
           <div class="wrap clear_both">             <productfooter></productfooter>         </div>
        </div>
    </div>
     
    <script src="../js/axios.js"></script>         <script src="../js/qs.js"></script>
    <script src="../js/swiper-4.3.5.min.js"></script>
    <script src="../js/browser.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/element.js"></script>
    <script src="../js/main.js"></script>
    <script type="text/babel">
        var app = new Vue({
            el: '#app',
            data() {
                return {
                    exchange_list:'',
                    input10:'',
                    input11:'',
                    car_active:false,
                    groups:3,
                    add_popup:false
                };
            },
            created() {
                
            },
            mounted() {
                this.findSpOrderReturnsListUser()
            },
            methods: {
                // 退换货列表
                findSpOrderReturnsListUser(){
                    axios({
                        method:"POST",
                        url:base_url + "/spOrder/findSpOrderReturnsListUser",
                        data:Qs.stringify({
                            timeType:0
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.exchange_list = res.data.data.list.list
                        console.log(app.exchange_list)
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                concel_exchange(id,status){
                    axios({
                        method:"POST",
                        url:base_url + "/spOrder/updateSpReturnsSatus",
                        data:Qs.stringify({
                            id:id,
                            status:status
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.findSpOrderReturnsListUser()
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },

                // 显示购物车               
                go_shop_car(){                     
                    window.location.href='../product/shop_car.html'  
                },
                car_box(){
                    this.car_active = !this.car_active
                },
                person_order(){
                    window.location.href='person_order.html'
                },
                person_address(){
                    window.location.href='person_address.html'
                },
                person_center(){
                    window.location.href='person_center.html?index='+0
                },
                person_integral(){
                    window.location.href='person_integral_order.html'
                },
                person_collection(){
                    window.location.href='person_collection.html'
                },
                person_foot(){
                    window.location.href='person_footprint.html'
                },
                person_info(){
                    window.location.href='person_info.html'
                },
                person_message(){
                    window.location.href='person_message.html'
                },
                person_ticket(){
                    window.location.href='person_ticket.html'
                },
                person_exchange(){
                    // window.location.href='person_exchange.html'
                }
            }
        })
        
    </script>
</body>

</html>